<template lang="">
    <div>
        <div class="search">
            <el-form ref="form" :model="form" label-width="80px">
                <el-row>
                    <el-col :span="6">
                        <el-form-item label="客户姓名">
                            <el-input size="small" v-model="form.name"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="客户手机">
                            <el-input size="small" v-model="form.name"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="归属人">
                            <el-input size="small" v-model="form.name"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="6">
                        <el-form-item label="渠道来源">
                            <el-select size="small" v-model="value" placeholder="请选择">
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="线索状态">
                            <el-select size="small" v-model="value" placeholder="请选择">
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item size="small" label="跟进时间">
                            <el-date-picker v-model="value1" type="datetimerange" range-separator="至"
                                start-placeholder="开始日期" end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-form-item>
                    <el-button type="primary">查询</el-button>
                    <el-button>取消</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="table" style="margin-top: 20px;">
                <el-table :data="tableData" border style="width: 100%"   @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55">
                </el-table-column>
                <el-table-column prop="clueId" label="线索编号" width="80">
                </el-table-column>
                <el-table-column prop="name" label="客户姓名" width="80">
                </el-table-column>
                <el-table-column prop="phone" label="手机号码">
                </el-table-column>
                 <el-table-column prop="channelName" label="渠道来源">
                </el-table-column>
                 <el-table-column prop="createTime" label="创建时间" width='180' show-overflow-tooltip>
                </el-table-column>
                 <el-table-column prop="owner" label="线索归属">
                </el-table-column>
                 <el-table-column prop="status" label="线索状态">
                    <template v-slot = 'scope'>
                        <!-- 当前行的信息 -->
                        <!-- {{scope.row}} -->
                        <el-tag v-if='scope.row.status == 1'>已分配</el-tag>
                        <el-tag v-if='scope.row.status == 2' type="success">跟进中</el-tag>
                        <el-tag type="info" v-if='scope.row.status == 0'>未知</el-tag>
                        <el-tag type="warning" v-if='scope.row.status == 4'>伪线索</el-tag>
                        <el-tag type="danger" v-if='scope.row.status == 3'>回收</el-tag>
                    </template>
</el-table-column>
<el-table-column prop="nextTime" label="下次跟进时间" width='180'>
</el-table-column>
<el-table-column label="操作" width=150>
    <template>
        <el-button size='mini'>修改</el-button>
        <el-button type='danger' size='mini'>删除</el-button>
    </template>
</el-table-column>
</el-table>
<!-- current-page当前页码 -->
<el-pagination @size-change="handleSizeChange" style='margin-top:10px' @current-change="handleCurrentChange"
    :current-page="query.pageNum" :page-sizes="[10, 20, 30, 40,50]" :page-size="10"
    layout="total, sizes, prev, pager, next, jumper" :total="total" background>
</el-pagination>
</div>
</div>
</template>
<script>
import { clueList } from '@/api/clue';
export default {
    data() {
        return {
            id: null,
            tableData: [],
            form: {

            },
            options: [{
                value: '选项1',
                label: '已分配'
            }, {
                value: '选项2',
                label: '跟进中'
            }, {
                value: '选项3',
                label: '未知'
            }, {
                value: '选项4',
                label: '伪线索'
            }, {
                value: '选项5',
                label: '回收'
            }],
            value: '',
            value1: '',
            query: {
                pageNum: 1,
                pageSize: 10
            },
            total: 0
        }
    },
    created() {
        this.getList()
    },
    methods: {
        getList() {
            clueList(this.query).then(res => {
                console.log(res);
                this.tableData = res.rows
                this.total = res.total
            })
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
            this.query.pageSize = val
            this.query.pageNum = 1
            //重新调用接口
            this.getList()
        },
        handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
            this.query.pageNum = val
            //重新调用接口
            this.getList()
        }
    }
}
</script>
<style lang="">

</style>